/**
 * Created by y on 2017/5/3.
 */
var qiniu = require('qiniu');

// 初始化ak,sk
qiniu.conf.ACCESS_KEY = '8cHriBP-rdMYMCSF4RgrCjiUvE7xCGud6SiJKUAH';
qiniu.conf.SECRET_KEY = 'F56WdbO_nKnOhTzo4b74GkrjYujUT2QFFvoWBR1d';

//上传策略 http://developer.qiniu.com/article/developer/security/put-policy.html
// bucket:key 空间名:文件名
var policy = {
    scope: 'city-bar',
    deadline: '3600000'
};
var putPolicy = new qiniu.rs.PutPolicy2(policy);
var token = putPolicy.token();
var getNanoTime = function () {
    var hrTime = process.hrtime();
    return (hrTime[0] * 1000000000 + hrTime[1]).toString();
};

module.exports = {token: token, nt: getNanoTime()};